package com.seata.cloud.service.impl;

import com.seata.cloud.dao.AccountDAO;
import com.seata.cloud.service.AccountService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.math.BigDecimal;

/**
 * 账户服务 - service层
 */
@Slf4j
@Service
public class AccountServiceImpl implements AccountService {

    
    @Autowired
    private AccountDAO accountDao;

    /**
     * 扣减账户余额
     */
    @Transactional
    @Override
    public void decrease(Long userId, BigDecimal money) {
        log.info("------->account-service中扣减账户余额开始");
        accountDao.decrease(userId,money);
        log.info("------->account-service中扣减账户余额结束");
    }
}
